function [ERRZ] = computerEssentialErrorSVDNFramesGeneralMOD(x,F,weights,w,h,outputformat)

[K]=convertXTOKselfK(x,w,h);
KT=K';

n=size(F,2);

ERRZ=zeros(n,1);

if(sum(weights)<eps)
   weights=ones(n,1)/n;
    display('weights were all zero, resetting to one');
end

for i=1:n
    ERRZ(i,1) =weights(i,1)* computerEssentialErrorSVD(F{1,i},K,KT);
end

if(outputformat==1) % leave error unaltered, measurements must match
    ERRZ=ERRZ;
elseif(outputformat==2) % leave errors same size as the number of unknown parameters but sum them up
    D=ones(size(x,2),1)*sum(abs(ERRZ));
    ERRZ=D;
elseif(outputformat==3)% leave errors same size as the number of fundamental matrices but they are now the same size parameters but sum them up
    D=ones(size(F,2),1)*sum(abs(ERRZ));
   ERRZ=D;    
elseif(outputformat==4)% just one value
    D=sum(abs(ERRZ));
    ERRZ=D;
elseif(outputformat==5)% just one value squared
    ERRZ=ERRZ.^2;
    D=sum(abs(ERRZ));
    ERRZ=D;
end


end
